Field
Aspects of the present invention generally relate to a communication apparatus, a method for controlling the same, and a storage medium.
Description of the Related Art
In recent years, an electronic apparatus, such as a digital camera and a printer, is equipped with a wireless local area network (LAN) station function, connected to a wireless LAN, and often used as a communication apparatus. For example, Japanese Patent Application Laid-Open No. 2009-152689 discusses a method for facilitating image sharing by providing a wireless LAN function for the digital camera.
Wi-Fi Direct® has been established as a Wi-Fi standard by Wi-Fi Alliance. The Wi-Fi Direct® prescribes a protocol determining whether each electronic apparatus operates as a wireless LAN access point or a wireless LAN station. By executing the protocol, it can be automatically determined which electronic apparatus operates as the wireless LAN access point or the wireless LAN station. The use of the Wi-Fi Direct® eliminates the need for separately preparing an access point. Consequently, the electronic apparatuses can directly communicate with each other and execute various services (image sharing, printing, and the like). Therefore, user friendliness is improved.
A function for searching an application layer for contents of a service provided by other apparatus (a service discovery function) is prescribed as an optional function of the Wi-Fi Direct®. The service discovery function enables the electric apparatus to acquire information about a service provided by an electronic apparatus to be connected before connection processing is executed. Therefore, user friendliness is improved.
As described above, in the Wi-Fi Direct®, service information is exchanged between the electric apparatuses in the wireless LAN layer. However, service processing actually executed is generally executed in a layer upper than a Transmission Control Protocol (TCP)/Internet Protocol (IP) layer (an application layer, for example). For this reason, control of opening and closing of a port (a User Datagram Protocol (UDP) port or a TCP port, for example) is required to execute the service processing.
In a case where there is a plurality of service types executable between the electric apparatuses, control of opening and closing of the corresponding port is performed every time a service to be executed is identified. It is inefficient from the viewpoint of opening processing time.
The present invention is directed to effective port control in executing a service between electric apparatuses.